.TH std::chrono::weekday 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::chrono::weekday \- std::chrono::weekday

.SH Synopsis
   Defined in header <chrono>
   class weekday;                                       \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Sunday{0};     \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Monday{1};     \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Tuesday{2};    \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Wednesday{3};  \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Thursday{4};   \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Friday{5};     \fI(since C++20)\fP
   inline constexpr std::chrono::weekday Saturday{6};   \fI(since C++20)\fP

   The class weekday represent a day of the week in the proleptic Gregorian calendar.
   Its normal range is [0, 6], for Sunday through Saturday, but it can hold any value
   in the range [0, 255]. Seven named constants are predefined in the std::chrono
   namespace for the seven days of the week.

   weekday is a TriviallyCopyable StandardLayoutType.

.SH Member functions

   constructor     constructs a weekday
                   \fI(public member function)\fP
   operator++
   operator++(int) increments or decrements the weekday
   operator--      \fI(public member function)\fP
   operator--(int)
   operator+=      adds or subtracts a number of days
   operator-=      \fI(public member function)\fP
   c_encoding      retrieves the stored weekday value
   iso_encoding    retrieves ISO 8601 weekday value
                   \fI(public member function)\fP
   ok              checks if the stored weekday value is valid
                   \fI(public member function)\fP
                   convenience syntax for constructing a weekday_indexed or
   operator[]      weekday_last from this weekday
                   \fI(public member function)\fP

   Nonmember functions

   operator==  compares two weekday values
   (C++20)     \fI(function)\fP
   operator+   performs arithmetic on weekdays
   operator-   \fI(function)\fP
   (C++20)
   operator<<  outputs a weekday into a stream
   (C++20)     \fI(function template)\fP
   from_stream parses a weekday from a stream according to the provided format
   (C++20)     \fI(function template)\fP

.SH Helper classes

   std::formatter<std::chrono::weekday> formatting support for weekday
   (C++20)                              \fI(class template specialization)\fP
   std::hash<std::chrono::weekday>      hash support for std::chrono::weekday
   (C++26)                              \fI(class template specialization)\fP

.SH Example


// Run this code

 #include <chrono>
 #include <iostream>

 int main()
 {
     std::chrono::weekday x{42 / 13};
     std::cout << x++ << '\\n';
     std::cout << x << '\\n';
     std::cout << ++x << '\\n';
 }

.SH Output:

 Wed
 Thu
 Fri

.SH See also

   weekday_indexed represents the n^th weekday of a month
   (C++20)         \fI(class)\fP
